﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace cit.CopyDetection
{
    public partial class frmTextContent : Form
    {
        private string fileName;

        public frmTextContent()
        {
            InitializeComponent();
        }

        public void ShowContent(string fileName) 
        {
            string strContent = string.Empty;
            if (File.Exists(fileName))
            {
                this.fileName = fileName;                
                StreamReader reader = new StreamReader(fileName, Encoding.UTF8);
                strContent = reader.ReadToEnd();
                reader.Close();

                this.Text = fileName;
                rtxtContent.Text = strContent;

                this.Show();
            }
            else
            {
                MessageBox.Show("File doesn't exist!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Dispose();
            }
        }
    }
}
